package com.wpre.rabbitmqspringboot.listener;

import com.wpre.rabbitmqspringboot.constant.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2025-03-31
 * Time: 20:10
 */
@Component
public class WorkListener {

    @RabbitListener(queues = Constants.WORK_QUEUE)//要从哪个队列中获取消息
    public void queueListener1(Message message) {
        System.out.println("[" + Constants.WORK_QUEUE + "] 接收到消息: " + message);
    }

    @RabbitListener(queues = Constants.WORK_QUEUE)//要从哪个队列中获取消息
    public void queueListener2(Message message) {
        System.out.println("[" + Constants.WORK_QUEUE + "] 接收到消息: " + message);
    }
}
